package com.ld.admin.websocket.chat.transformer;

import javax.websocket.EncodeException;
import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.ld.admin.websocket.chat.model.UsersOnlineModel;

public class UsersOnlineEncoder implements Encoder.Text<UsersOnlineModel> {
    @Override
    public void init(final EndpointConfig config) {
    }

    @Override
    public void destroy() {
    }

    @Override
    public String encode(final UsersOnlineModel chatMessage) throws EncodeException {
        return JSON.toJSONString(chatMessage, SerializerFeature.BrowserCompatible);
    }
}
